package cc.iotkit.data.model;

import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.listener.TenantListener;
import cc.iotkit.model.Owned;
import cc.iotkit.model.TenantModel;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.ParamDef;

import javax.persistence.*;

/**
 * 微自然网关与设备关系表
 * 设备与网关虚拟地址关系，设备的mac与网关的pvid
 */
@Data
@Entity
@ApiModel(value = "设备网关关系")
@Table(name = "wzr_gw_dev")
@AutoMapper(target = TbWzrGwDev.class)
@FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "long")})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
@EntityListeners(TenantListener.class)
public class TbWzrGwDev extends BaseEntity implements TenantAware, Owned<String> {
    @Id
    @GeneratedValue(generator = "SnowflakeIdGenerator")
    @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
    @ApiModelProperty(value = "列表id")
    private String id;

    private String deviceId;
    /**
     * 产品key
     */
    private String productKey;

    private String deviceName;

    private String deviceMac;

    private int gwPvid;

    private String gwName;
    /**
     * 所属平台用户ID
     */
    private String uid;

    private Long tenantId;

}
